<?php
$dis_id=2;
include("../../inc/conn.inc");
include("../islogin.php");
$url="templet.php";
$thepage=$_GET['page']?$_GET['page']:1;
$maxpage=20;

$m_rs=mysql_query("select id,template,m_type from member where id='".$_COOKIE['user_id']."'");
$m_row=mysql_fetch_array($m_rs);

if($_POST[template]){
  if($m_row['m_type']==6 || $m_row['m_type']==3){
	   mysql_query("update member set template='$_POST[template]' where id='".$_COOKIE['user_id']."'");
	   
	   echo "<script>location='templet.php';</script>";
	 }else{
	 
	 echo "<script>alert('请升级我们的钻石会员');location='templet.php';</script>";
	 }
}
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>会员中心-三帝贸易网</title>
<link href="../css/css.css" rel="stylesheet" type="text/css" />
<link href="../css/template.css" rel="stylesheet" type="text/css" />

</head>
<script type="text/javascript" src="../js/left.js"></script>
<body>
<div id="mian">
<?php include("../inc/top.php");?>
<div class="top1"><span>您当前位置：<a href="../index.php" class="dh">会员助手</a> &gt;&gt; 企业网站配置 &gt;&gt; 网站模板管理</span></div>
<div class="left">
<?php include("../inc/left.php");?>
</div>
<div class="right">
<TABLE cellSpacing="0" cellPadding="0" width="100%" border="0">
   <TR>
     <TD height="40" bgcolor="#EFF6FF" style="font-size:18px;font-weight:bold;padding-left:8px;">网站模板管理</TD>
   </TR>
</TABLE>
<br>
<font color="#FF0000">注：此功能对钻石会员开放</font>&nbsp;<A href="../sj.php">立即升级</A>
<br>
<br>
<div class="Imginfo">
<?php
$sql="select id,t_id,picture,t_name from template where t_type =".$per_row['m_type']." order by id asc limit ".($thepage-1)*$maxpage.",$maxpage";
$rs=mysql_query($sql);
$i=1;
while($row=mysql_fetch_array($rs)){
	$yulanurl = ($per_row['m_type']==6) ? "http://".$_COOKIE['user_name'].".sandib2b.cn/template/yulan/".$row['t_id'].".html" : "http://www.sandib2b.cn/cn/template/".$_COOKIE['user_name']."/yulan/".$row['t_id'].".html";
?>
<div class="ImgBoxList">
     <form method="post" action="">
      <div class="checkbox">
      <input name="template" type="checkbox" value="<?=$row[t_id]?>" <?php if($m_row[template]==$row[t_id]){echo "checked";}?>/>
      </div>
      <div class="Img"><img src="/img/<?=$row[picture]?>" border="0" width="114" height="126"/></div>
      <div class="nameTxt size12"><?=$row[t_name]?></div>
	  <div class="nameTxt size12"><input type="submit" value="提交" />&nbsp;&nbsp;<a href="<?php echo $yulanurl;?>" target="_blank"><img src="/member/images/yulan.jpg" width="39" height="24" border="0" align="absmiddle"></a></div>
     </form>
<div class="onl"></div>
</div>
<?php
$i++;
}?>
<div class="onl"></div>
</div>
<div class="page" align="center">
<?php
$rs2=mysql_query("select count(id) from template where t_type =".$per_row['m_type']);
$totalrecord=mysql_result($rs2,0);
$totalpage=ceil($totalrecord/$maxpage);
mysql_free_result($rs2);
if($totalpage>0){
?>
<script language="javascript">
<!--
function showPageLink(sUrl,iPage,iCount){
	var i;
	i=Math.max(1,iPage-1);
	document.write("<a href=\"" + sUrl + "1\">«</a> ");
	document.write("<a href=\"" + sUrl + i + "\">上一页</a> ");
	for(i=Math.max(1,iPage-8);i<iPage;i++){
		document.write("<a href=\""+sUrl + i + "\"><b>" + i + "</b></a> ");
	}
	document.write("<font color='#ff3333'><b>" + iPage + "</b></font> ");
	for(i=iPage+1;i<=Math.min(iCount,iPage+8);i++){
		document.write("<a href=\""+sUrl + i + "\"><b>" + i + "</b></a> ");
	}
	i=Math.min(iCount,iPage+1);
	if(iCount>iPage+8) document.write("<span style='font-size:8px'>···</span> ");
	document.write("<a href=\"" + sUrl + i + "\">下一页</a> ");
	document.write("<a href=\"" + sUrl + iCount + "\">»</a> ");
}
showPageLink("<?=$url?>?page=",<?=$thepage?>,<?=$totalpage?>);
//-->
</script><?php }?>
<div class="onl"></div>
</div>
</div>
<div class="onl"></div>
<?php include("../inc/foot.php");?>
</div>
</body>
</html>
